﻿using System;
using System.ComponentModel;
using System.IO;
using System.Runtime.Serialization;

namespace HalconDotNet
{
	/// <summary>Represents an instance of an NCC model for matching.</summary>
	// Token: 0x0200004E RID: 78
	[Serializable]
	public class HNCCModel : HHandle, ISerializable, ICloneable
	{
		// Token: 0x06000AD2 RID: 2770 RVA: 0x0000883B File Offset: 0x00006A3B
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HNCCModel() : base(HHandleBase.UNDEF)
		{
		}

		// Token: 0x06000AD3 RID: 2771 RVA: 0x00044B64 File Offset: 0x00042D64
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HNCCModel(IntPtr handle) : base(handle)
		{
			this.AssertSemType();
		}

		// Token: 0x06000AD4 RID: 2772 RVA: 0x00044B73 File Offset: 0x00042D73
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HNCCModel(HHandle handle) : base(handle)
		{
			this.AssertSemType();
		}

		// Token: 0x06000AD5 RID: 2773 RVA: 0x00044B82 File Offset: 0x00042D82
		private void AssertSemType()
		{
			base.AssertSemType("ncc_model");
		}

		// Token: 0x06000AD6 RID: 2774 RVA: 0x00044B8F File Offset: 0x00042D8F
		internal static int LoadNew(IntPtr proc, int parIndex, int err, out HNCCModel obj)
		{
			obj = new HNCCModel(HHandleBase.UNDEF);
			return obj.Load(proc, parIndex, err);
		}

		// Token: 0x06000AD7 RID: 2775 RVA: 0x00044BA8 File Offset: 0x00042DA8
		internal static int LoadNew(IntPtr proc, int parIndex, int err, out HNCCModel[] obj)
		{
			HTuple htuple;
			err = HTuple.LoadNew(proc, parIndex, err, out htuple);
			obj = new HNCCModel[htuple.Length];
			for (int i = 0; i < htuple.Length; i++)
			{
				obj[i] = new HNCCModel(HalconAPI.IsLegacyHandleMode() ? htuple[i].IP : htuple[i].H);
			}
			htuple.Dispose();
			return err;
		}

		/// <summary>
		///   Read an NCC model from a file.
		///   Modified instance represents: Handle of the model.
		/// </summary>
		/// <param name="fileName">File name.</param>
		// Token: 0x06000AD8 RID: 2776 RVA: 0x00044C18 File Offset: 0x00042E18
		public HNCCModel(string fileName)
		{
			IntPtr proc = HalconAPI.PreCall(985);
			HalconAPI.StoreS(proc, 0, fileName);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Prepare an NCC model for matching.
		///   Modified instance represents: Handle of the model.
		/// </summary>
		/// <param name="template">Input image whose domain will be used to create the model.</param>
		/// <param name="numLevels">Maximum number of pyramid levels. Default: "auto"</param>
		/// <param name="angleStart">Smallest rotation of the pattern. Default: -0.39</param>
		/// <param name="angleExtent">Extent of the rotation angles. Default: 0.79</param>
		/// <param name="angleStep">Step length of the angles (resolution). Default: "auto"</param>
		/// <param name="metric">Match metric. Default: "use_polarity"</param>
		// Token: 0x06000AD9 RID: 2777 RVA: 0x00044C64 File Offset: 0x00042E64
		public HNCCModel(HImage template, HTuple numLevels, double angleStart, double angleExtent, HTuple angleStep, string metric)
		{
			IntPtr proc = HalconAPI.PreCall(993);
			HalconAPI.Store(proc, 1, template);
			HalconAPI.Store(proc, 0, numLevels);
			HalconAPI.StoreD(proc, 1, angleStart);
			HalconAPI.StoreD(proc, 2, angleExtent);
			HalconAPI.Store(proc, 3, angleStep);
			HalconAPI.StoreS(proc, 4, metric);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(numLevels);
			HalconAPI.UnpinTuple(angleStep);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(template);
		}

		/// <summary>
		///   Prepare an NCC model for matching.
		///   Modified instance represents: Handle of the model.
		/// </summary>
		/// <param name="template">Input image whose domain will be used to create the model.</param>
		/// <param name="numLevels">Maximum number of pyramid levels. Default: "auto"</param>
		/// <param name="angleStart">Smallest rotation of the pattern. Default: -0.39</param>
		/// <param name="angleExtent">Extent of the rotation angles. Default: 0.79</param>
		/// <param name="angleStep">Step length of the angles (resolution). Default: "auto"</param>
		/// <param name="metric">Match metric. Default: "use_polarity"</param>
		// Token: 0x06000ADA RID: 2778 RVA: 0x00044CF0 File Offset: 0x00042EF0
		public HNCCModel(HImage template, int numLevels, double angleStart, double angleExtent, double angleStep, string metric)
		{
			IntPtr proc = HalconAPI.PreCall(993);
			HalconAPI.Store(proc, 1, template);
			HalconAPI.StoreI(proc, 0, numLevels);
			HalconAPI.StoreD(proc, 1, angleStart);
			HalconAPI.StoreD(proc, 2, angleExtent);
			HalconAPI.StoreD(proc, 3, angleStep);
			HalconAPI.StoreS(proc, 4, metric);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(template);
		}

		// Token: 0x06000ADB RID: 2779 RVA: 0x00044D70 File Offset: 0x00042F70
		void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
		{
			HSerializedItem hserializedItem = this.SerializeNccModel();
			byte[] value = hserializedItem;
			hserializedItem.Dispose();
			info.AddValue("data", value, typeof(byte[]));
		}

		// Token: 0x06000ADC RID: 2780 RVA: 0x00044DA8 File Offset: 0x00042FA8
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HNCCModel(SerializationInfo info, StreamingContext context)
		{
			HSerializedItem hserializedItem = new HSerializedItem((byte[])info.GetValue("data", typeof(byte[])));
			this.DeserializeNccModel(hserializedItem);
			hserializedItem.Dispose();
		}

		/// <summary>Serialize object to binary stream in HALCON format</summary>
		// Token: 0x06000ADD RID: 2781 RVA: 0x00044DE8 File Offset: 0x00042FE8
		public new void Serialize(Stream stream)
		{
			HSerializedItem hserializedItem = this.SerializeNccModel();
			hserializedItem.Serialize(stream);
			hserializedItem.Dispose();
		}

		/// <summary>Deserialize object from binary stream in HALCON format</summary>
		// Token: 0x06000ADE RID: 2782 RVA: 0x00044DFC File Offset: 0x00042FFC
		public new static HNCCModel Deserialize(Stream stream)
		{
			HNCCModel hnccmodel = new HNCCModel();
			HSerializedItem hserializedItem = HSerializedItem.Deserialize(stream);
			hnccmodel.DeserializeNccModel(hserializedItem);
			hserializedItem.Dispose();
			return hnccmodel;
		}

		// Token: 0x06000ADF RID: 2783 RVA: 0x00044E22 File Offset: 0x00043022
		object ICloneable.Clone()
		{
			return this.Clone();
		}

		// Token: 0x06000AE0 RID: 2784 RVA: 0x00044E2C File Offset: 0x0004302C
		public new HNCCModel Clone()
		{
			HSerializedItem hserializedItem = this.SerializeNccModel();
			HNCCModel hnccmodel = new HNCCModel();
			hnccmodel.DeserializeNccModel(hserializedItem);
			hserializedItem.Dispose();
			return hnccmodel;
		}

		/// <summary>
		///   Free the memory of an NCC model.
		///   Instance represents: Handle of the model.
		/// </summary>
		// Token: 0x06000AE1 RID: 2785 RVA: 0x00044E54 File Offset: 0x00043054
		public void ClearNccModel()
		{
			IntPtr proc = HalconAPI.PreCall(982);
			base.Store(proc, 0);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Deserialize an NCC model.
		///   Modified instance represents: Handle of the model.
		/// </summary>
		/// <param name="serializedItemHandle">Handle of the serialized item.</param>
		// Token: 0x06000AE2 RID: 2786 RVA: 0x00044E88 File Offset: 0x00043088
		public void DeserializeNccModel(HSerializedItem serializedItemHandle)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(983);
			HalconAPI.Store(proc, 0, serializedItemHandle);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(serializedItemHandle);
		}

		/// <summary>
		///   Serialize an NCC model.
		///   Instance represents: Handle of the model.
		/// </summary>
		/// <returns>Handle of the serialized item.</returns>
		// Token: 0x06000AE3 RID: 2787 RVA: 0x00044EDC File Offset: 0x000430DC
		public HSerializedItem SerializeNccModel()
		{
			IntPtr proc = HalconAPI.PreCall(984);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HSerializedItem result;
			num = HSerializedItem.LoadNew(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Read an NCC model from a file.
		///   Modified instance represents: Handle of the model.
		/// </summary>
		/// <param name="fileName">File name.</param>
		// Token: 0x06000AE4 RID: 2788 RVA: 0x00044F24 File Offset: 0x00043124
		public void ReadNccModel(string fileName)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(985);
			HalconAPI.StoreS(proc, 0, fileName);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Write an NCC model to a file.
		///   Instance represents: Handle of the model.
		/// </summary>
		/// <param name="fileName">File name.</param>
		// Token: 0x06000AE5 RID: 2789 RVA: 0x00044F70 File Offset: 0x00043170
		public void WriteNccModel(string fileName)
		{
			IntPtr proc = HalconAPI.PreCall(986);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, fileName);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>Determine the parameters of an NCC model.</summary>
		/// <param name="template">Input image whose domain will be used to create the model.</param>
		/// <param name="numLevels">Maximum number of pyramid levels. Default: "auto"</param>
		/// <param name="angleStart">Smallest rotation of the model. Default: -0.39</param>
		/// <param name="angleExtent">Extent of the rotation angles. Default: 0.79</param>
		/// <param name="metric">Match metric. Default: "use_polarity"</param>
		/// <param name="parameters">Parameters to be determined automatically. Default: "all"</param>
		/// <param name="parameterValue">Value of the automatically determined parameter.</param>
		/// <returns>Name of the automatically determined parameter.</returns>
		// Token: 0x06000AE6 RID: 2790 RVA: 0x00044FAC File Offset: 0x000431AC
		public static HTuple DetermineNccModelParams(HImage template, HTuple numLevels, double angleStart, double angleExtent, string metric, HTuple parameters, out HTuple parameterValue)
		{
			IntPtr proc = HalconAPI.PreCall(987);
			HalconAPI.Store(proc, 1, template);
			HalconAPI.Store(proc, 0, numLevels);
			HalconAPI.StoreD(proc, 1, angleStart);
			HalconAPI.StoreD(proc, 2, angleExtent);
			HalconAPI.StoreS(proc, 3, metric);
			HalconAPI.Store(proc, 4, parameters);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(numLevels);
			HalconAPI.UnpinTuple(parameters);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, num, out result);
			num = HTuple.LoadNew(proc, 1, num, out parameterValue);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(template);
			return result;
		}

		/// <summary>Determine the parameters of an NCC model.</summary>
		/// <param name="template">Input image whose domain will be used to create the model.</param>
		/// <param name="numLevels">Maximum number of pyramid levels. Default: "auto"</param>
		/// <param name="angleStart">Smallest rotation of the model. Default: -0.39</param>
		/// <param name="angleExtent">Extent of the rotation angles. Default: 0.79</param>
		/// <param name="metric">Match metric. Default: "use_polarity"</param>
		/// <param name="parameters">Parameters to be determined automatically. Default: "all"</param>
		/// <param name="parameterValue">Value of the automatically determined parameter.</param>
		/// <returns>Name of the automatically determined parameter.</returns>
		// Token: 0x06000AE7 RID: 2791 RVA: 0x0004503C File Offset: 0x0004323C
		public static HTuple DetermineNccModelParams(HImage template, int numLevels, double angleStart, double angleExtent, string metric, string parameters, out HTuple parameterValue)
		{
			IntPtr proc = HalconAPI.PreCall(987);
			HalconAPI.Store(proc, 1, template);
			HalconAPI.StoreI(proc, 0, numLevels);
			HalconAPI.StoreD(proc, 1, angleStart);
			HalconAPI.StoreD(proc, 2, angleExtent);
			HalconAPI.StoreS(proc, 3, metric);
			HalconAPI.StoreS(proc, 4, parameters);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, num, out result);
			num = HTuple.LoadNew(proc, 1, num, out parameterValue);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(template);
			return result;
		}

		/// <summary>
		///   Return the parameters of an NCC model.
		///   Instance represents: Handle of the model.
		/// </summary>
		/// <param name="angleStart">Smallest rotation of the pattern.</param>
		/// <param name="angleExtent">Extent of the rotation angles.</param>
		/// <param name="angleStep">Step length of the angles (resolution).</param>
		/// <param name="metric">Match metric.</param>
		/// <returns>Number of pyramid levels.</returns>
		// Token: 0x06000AE8 RID: 2792 RVA: 0x000450C0 File Offset: 0x000432C0
		public int GetNccModelParams(out double angleStart, out double angleExtent, out double angleStep, out string metric)
		{
			IntPtr proc = HalconAPI.PreCall(988);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			HalconAPI.InitOCT(proc, 3);
			HalconAPI.InitOCT(proc, 4);
			int num = HalconAPI.CallProcedure(proc);
			int result;
			num = HalconAPI.LoadI(proc, 0, num, out result);
			num = HalconAPI.LoadD(proc, 1, num, out angleStart);
			num = HalconAPI.LoadD(proc, 2, num, out angleExtent);
			num = HalconAPI.LoadD(proc, 3, num, out angleStep);
			num = HalconAPI.LoadS(proc, 4, num, out metric);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Return the origin (reference point) of an NCC model.
		///   Instance represents: Handle of the model.
		/// </summary>
		/// <param name="row">Row coordinate of the origin of the NCC model.</param>
		/// <param name="column">Column coordinate of the origin of the NCC model.</param>
		// Token: 0x06000AE9 RID: 2793 RVA: 0x00045154 File Offset: 0x00043354
		public void GetNccModelOrigin(out double row, out double column)
		{
			IntPtr proc = HalconAPI.PreCall(989);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			num = HalconAPI.LoadD(proc, 0, num, out row);
			num = HalconAPI.LoadD(proc, 1, num, out column);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Set the origin (reference point) of an NCC model.
		///   Instance represents: Handle of the model.
		/// </summary>
		/// <param name="row">Row coordinate of the origin of the NCC model.</param>
		/// <param name="column">Column coordinate of the origin of the NCC model.</param>
		// Token: 0x06000AEA RID: 2794 RVA: 0x000451AC File Offset: 0x000433AC
		public void SetNccModelOrigin(double row, double column)
		{
			IntPtr proc = HalconAPI.PreCall(990);
			base.Store(proc, 0);
			HalconAPI.StoreD(proc, 1, row);
			HalconAPI.StoreD(proc, 2, column);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Find the best matches of an NCC model in an image.
		///   Instance represents: Handle of the model.
		/// </summary>
		/// <param name="image">Input image in which the model should be found.</param>
		/// <param name="angleStart">Smallest rotation of the model. Default: -0.39</param>
		/// <param name="angleExtent">Extent of the rotation angles. Default: 0.79</param>
		/// <param name="minScore">Minimum score of the instances of the model to be found. Default: 0.8</param>
		/// <param name="numMatches">Number of instances of the model to be found (or 0 for all matches). Default: 1</param>
		/// <param name="maxOverlap">Maximum overlap of the instances of the model to be found. Default: 0.5</param>
		/// <param name="subPixel">Subpixel accuracy. Default: "true"</param>
		/// <param name="numLevels">Number of pyramid levels used in the matching (and lowest pyramid level to use if $|NumLevels| = 2$). Default: 0</param>
		/// <param name="row">Row coordinate of the found instances of the model.</param>
		/// <param name="column">Column coordinate of the found instances of the model.</param>
		/// <param name="angle">Rotation angle of the found instances of the model.</param>
		/// <param name="score">Score of the found instances of the model.</param>
		// Token: 0x06000AEB RID: 2795 RVA: 0x000451F0 File Offset: 0x000433F0
		public void FindNccModel(HImage image, double angleStart, double angleExtent, double minScore, int numMatches, double maxOverlap, string subPixel, HTuple numLevels, out HTuple row, out HTuple column, out HTuple angle, out HTuple score)
		{
			IntPtr proc = HalconAPI.PreCall(991);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, image);
			HalconAPI.StoreD(proc, 1, angleStart);
			HalconAPI.StoreD(proc, 2, angleExtent);
			HalconAPI.StoreD(proc, 3, minScore);
			HalconAPI.StoreI(proc, 4, numMatches);
			HalconAPI.StoreD(proc, 5, maxOverlap);
			HalconAPI.StoreS(proc, 6, subPixel);
			HalconAPI.Store(proc, 7, numLevels);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			HalconAPI.InitOCT(proc, 3);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(numLevels);
			num = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, num, out row);
			num = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, num, out column);
			num = HTuple.LoadNew(proc, 2, HTupleType.DOUBLE, num, out angle);
			num = HTuple.LoadNew(proc, 3, HTupleType.DOUBLE, num, out score);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(image);
		}

		/// <summary>
		///   Find the best matches of an NCC model in an image.
		///   Instance represents: Handle of the model.
		/// </summary>
		/// <param name="image">Input image in which the model should be found.</param>
		/// <param name="angleStart">Smallest rotation of the model. Default: -0.39</param>
		/// <param name="angleExtent">Extent of the rotation angles. Default: 0.79</param>
		/// <param name="minScore">Minimum score of the instances of the model to be found. Default: 0.8</param>
		/// <param name="numMatches">Number of instances of the model to be found (or 0 for all matches). Default: 1</param>
		/// <param name="maxOverlap">Maximum overlap of the instances of the model to be found. Default: 0.5</param>
		/// <param name="subPixel">Subpixel accuracy. Default: "true"</param>
		/// <param name="numLevels">Number of pyramid levels used in the matching (and lowest pyramid level to use if $|NumLevels| = 2$). Default: 0</param>
		/// <param name="row">Row coordinate of the found instances of the model.</param>
		/// <param name="column">Column coordinate of the found instances of the model.</param>
		/// <param name="angle">Rotation angle of the found instances of the model.</param>
		/// <param name="score">Score of the found instances of the model.</param>
		// Token: 0x06000AEC RID: 2796 RVA: 0x000452C8 File Offset: 0x000434C8
		public void FindNccModel(HImage image, double angleStart, double angleExtent, double minScore, int numMatches, double maxOverlap, string subPixel, int numLevels, out HTuple row, out HTuple column, out HTuple angle, out HTuple score)
		{
			IntPtr proc = HalconAPI.PreCall(991);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, image);
			HalconAPI.StoreD(proc, 1, angleStart);
			HalconAPI.StoreD(proc, 2, angleExtent);
			HalconAPI.StoreD(proc, 3, minScore);
			HalconAPI.StoreI(proc, 4, numMatches);
			HalconAPI.StoreD(proc, 5, maxOverlap);
			HalconAPI.StoreS(proc, 6, subPixel);
			HalconAPI.StoreI(proc, 7, numLevels);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			HalconAPI.InitOCT(proc, 3);
			int num = HalconAPI.CallProcedure(proc);
			num = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, num, out row);
			num = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, num, out column);
			num = HTuple.LoadNew(proc, 2, HTupleType.DOUBLE, num, out angle);
			num = HTuple.LoadNew(proc, 3, HTupleType.DOUBLE, num, out score);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(image);
		}

		/// <summary>
		///   Set selected parameters of the NCC model.
		///   Instance represents: Handle of the model.
		/// </summary>
		/// <param name="genParamName">Parameter names.</param>
		/// <param name="genParamValue">Parameter values.</param>
		// Token: 0x06000AED RID: 2797 RVA: 0x00045398 File Offset: 0x00043598
		public void SetNccModelParam(HTuple genParamName, HTuple genParamValue)
		{
			IntPtr proc = HalconAPI.PreCall(992);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, genParamName);
			HalconAPI.Store(proc, 2, genParamValue);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Prepare an NCC model for matching.
		///   Modified instance represents: Handle of the model.
		/// </summary>
		/// <param name="template">Input image whose domain will be used to create the model.</param>
		/// <param name="numLevels">Maximum number of pyramid levels. Default: "auto"</param>
		/// <param name="angleStart">Smallest rotation of the pattern. Default: -0.39</param>
		/// <param name="angleExtent">Extent of the rotation angles. Default: 0.79</param>
		/// <param name="angleStep">Step length of the angles (resolution). Default: "auto"</param>
		/// <param name="metric">Match metric. Default: "use_polarity"</param>
		// Token: 0x06000AEE RID: 2798 RVA: 0x000453E8 File Offset: 0x000435E8
		public void CreateNccModel(HImage template, HTuple numLevels, double angleStart, double angleExtent, HTuple angleStep, string metric)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(993);
			HalconAPI.Store(proc, 1, template);
			HalconAPI.Store(proc, 0, numLevels);
			HalconAPI.StoreD(proc, 1, angleStart);
			HalconAPI.StoreD(proc, 2, angleExtent);
			HalconAPI.Store(proc, 3, angleStep);
			HalconAPI.StoreS(proc, 4, metric);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(numLevels);
			HalconAPI.UnpinTuple(angleStep);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(template);
		}

		/// <summary>
		///   Prepare an NCC model for matching.
		///   Modified instance represents: Handle of the model.
		/// </summary>
		/// <param name="template">Input image whose domain will be used to create the model.</param>
		/// <param name="numLevels">Maximum number of pyramid levels. Default: "auto"</param>
		/// <param name="angleStart">Smallest rotation of the pattern. Default: -0.39</param>
		/// <param name="angleExtent">Extent of the rotation angles. Default: 0.79</param>
		/// <param name="angleStep">Step length of the angles (resolution). Default: "auto"</param>
		/// <param name="metric">Match metric. Default: "use_polarity"</param>
		// Token: 0x06000AEF RID: 2799 RVA: 0x00045474 File Offset: 0x00043674
		public void CreateNccModel(HImage template, int numLevels, double angleStart, double angleExtent, double angleStep, string metric)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(993);
			HalconAPI.Store(proc, 1, template);
			HalconAPI.StoreI(proc, 0, numLevels);
			HalconAPI.StoreD(proc, 1, angleStart);
			HalconAPI.StoreD(proc, 2, angleExtent);
			HalconAPI.StoreD(proc, 3, angleStep);
			HalconAPI.StoreS(proc, 4, metric);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(template);
		}

		/// <summary>Find the best matches of multiple NCC models.</summary>
		/// <param name="image">Input image in which the model should be found.</param>
		/// <param name="modelIDs">Handle of the models.</param>
		/// <param name="angleStart">Smallest rotation of the models. Default: -0.39</param>
		/// <param name="angleExtent">Extent of the rotation angles. Default: 0.79</param>
		/// <param name="minScore">Minimum score of the instances of the models to be found. Default: 0.8</param>
		/// <param name="numMatches">Number of instances of the models to be found (or 0 for all matches). Default: 1</param>
		/// <param name="maxOverlap">Maximum overlap of the instances of the models to be found. Default: 0.5</param>
		/// <param name="subPixel">Subpixel accuracy if not equal to 'none'. Default: "true"</param>
		/// <param name="numLevels">Number of pyramid levels used in the matching (and lowest pyramid level to use if $|NumLevels| = 2$). Default: 0</param>
		/// <param name="row">Row coordinate of the found instances of the models.</param>
		/// <param name="column">Column coordinate of the found instances of the models.</param>
		/// <param name="angle">Rotation angle of the found instances of the models.</param>
		/// <param name="score">Score of the found instances of the models.</param>
		/// <param name="model">Index of the found instances of the models.</param>
		// Token: 0x06000AF0 RID: 2800 RVA: 0x000454F4 File Offset: 0x000436F4
		public static void FindNccModels(HImage image, HNCCModel[] modelIDs, HTuple angleStart, HTuple angleExtent, HTuple minScore, HTuple numMatches, HTuple maxOverlap, HTuple subPixel, HTuple numLevels, out HTuple row, out HTuple column, out HTuple angle, out HTuple score, out HTuple model)
		{
			HTuple htuple = HHandleBase.ConcatArray(modelIDs);
			IntPtr proc = HalconAPI.PreCall(2068);
			HalconAPI.Store(proc, 1, image);
			HalconAPI.Store(proc, 0, htuple);
			HalconAPI.Store(proc, 1, angleStart);
			HalconAPI.Store(proc, 2, angleExtent);
			HalconAPI.Store(proc, 3, minScore);
			HalconAPI.Store(proc, 4, numMatches);
			HalconAPI.Store(proc, 5, maxOverlap);
			HalconAPI.Store(proc, 6, subPixel);
			HalconAPI.Store(proc, 7, numLevels);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			HalconAPI.InitOCT(proc, 3);
			HalconAPI.InitOCT(proc, 4);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(htuple);
			HalconAPI.UnpinTuple(angleStart);
			HalconAPI.UnpinTuple(angleExtent);
			HalconAPI.UnpinTuple(minScore);
			HalconAPI.UnpinTuple(numMatches);
			HalconAPI.UnpinTuple(maxOverlap);
			HalconAPI.UnpinTuple(subPixel);
			HalconAPI.UnpinTuple(numLevels);
			num = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, num, out row);
			num = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, num, out column);
			num = HTuple.LoadNew(proc, 2, HTupleType.DOUBLE, num, out angle);
			num = HTuple.LoadNew(proc, 3, HTupleType.DOUBLE, num, out score);
			num = HTuple.LoadNew(proc, 4, HTupleType.INTEGER, num, out model);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(image);
			GC.KeepAlive(modelIDs);
		}

		/// <summary>
		///   Find the best matches of multiple NCC models.
		///   Instance represents: Handle of the models.
		/// </summary>
		/// <param name="image">Input image in which the model should be found.</param>
		/// <param name="angleStart">Smallest rotation of the models. Default: -0.39</param>
		/// <param name="angleExtent">Extent of the rotation angles. Default: 0.79</param>
		/// <param name="minScore">Minimum score of the instances of the models to be found. Default: 0.8</param>
		/// <param name="numMatches">Number of instances of the models to be found (or 0 for all matches). Default: 1</param>
		/// <param name="maxOverlap">Maximum overlap of the instances of the models to be found. Default: 0.5</param>
		/// <param name="subPixel">Subpixel accuracy if not equal to 'none'. Default: "true"</param>
		/// <param name="numLevels">Number of pyramid levels used in the matching (and lowest pyramid level to use if $|NumLevels| = 2$). Default: 0</param>
		/// <param name="row">Row coordinate of the found instances of the models.</param>
		/// <param name="column">Column coordinate of the found instances of the models.</param>
		/// <param name="angle">Rotation angle of the found instances of the models.</param>
		/// <param name="score">Score of the found instances of the models.</param>
		/// <param name="model">Index of the found instances of the models.</param>
		// Token: 0x06000AF1 RID: 2801 RVA: 0x00045614 File Offset: 0x00043814
		public void FindNccModels(HImage image, double angleStart, double angleExtent, double minScore, int numMatches, double maxOverlap, string subPixel, int numLevels, out HTuple row, out HTuple column, out HTuple angle, out HTuple score, out HTuple model)
		{
			IntPtr proc = HalconAPI.PreCall(2068);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, image);
			HalconAPI.StoreD(proc, 1, angleStart);
			HalconAPI.StoreD(proc, 2, angleExtent);
			HalconAPI.StoreD(proc, 3, minScore);
			HalconAPI.StoreI(proc, 4, numMatches);
			HalconAPI.StoreD(proc, 5, maxOverlap);
			HalconAPI.StoreS(proc, 6, subPixel);
			HalconAPI.StoreI(proc, 7, numLevels);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			HalconAPI.InitOCT(proc, 3);
			HalconAPI.InitOCT(proc, 4);
			int num = HalconAPI.CallProcedure(proc);
			num = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, num, out row);
			num = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, num, out column);
			num = HTuple.LoadNew(proc, 2, HTupleType.DOUBLE, num, out angle);
			num = HTuple.LoadNew(proc, 3, HTupleType.DOUBLE, num, out score);
			num = HTuple.LoadNew(proc, 4, HTupleType.INTEGER, num, out model);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(image);
		}

		/// <summary>
		///   Return the region used to create an NCC model.
		///   Instance represents: Handle of the model.
		/// </summary>
		/// <returns>Model region of the NCC model.</returns>
		// Token: 0x06000AF2 RID: 2802 RVA: 0x000456F8 File Offset: 0x000438F8
		public HRegion GetNccModelRegion()
		{
			IntPtr proc = HalconAPI.PreCall(2071);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HRegion result;
			num = HRegion.LoadNew(proc, 1, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}
	}
}
